package
{
	import DB.NotesDB;
	
	import views.instaGibHome;

	public class Registry
	{
		import DB.LocalPersistence;
		
		import flash.net.LocalConnection;
		import flash.system.ApplicationDomain;
		import flash.system.Capabilities;
		
		import mx.collections.ArrayList;
		import mx.rpc.events.FaultEvent;
		import mx.rpc.events.ResultEvent;
		
		public static var myDPI;
		
		private static var db:LocalPersistence = new LocalPersistence();
		private static var dbNotes:NotesDB = new NotesDB();
		[Embed(source='assets/pattern.png')]
		public static var pattern:Class;
		
		[Embed(source='assets/patternTop.png')]
		public static var patternTop:Class;
		
		[Embed(source='assets/Html.png')]
		public static var html:Class;
		
		[Embed(source='assets/doc.png')]
		public static var doc:Class;
		
		[Embed(source='assets/arrow.png')]
		public static var arrow:Class;
		
		public static var mainLang = 'en';
		
		public function Registry()
		{
			//Nothing much...
		}
		
		public static function initDB()
		{
			db.realInit();
			dbNotes.realInit();
			getDPI();
		}
		
		/////////////////////////////////////////////////
		// DPI SETTINGS //
		/////////////////////////////////////////////////
		
		private static function getDPI()
		{
			var DPI = Capabilities.screenDPI;
			//trace(DPI);
			myDPI = DPI
		}
		
		public static function getAllGibs()
		{
			var result = db.nowShow();
			
			return result;
		}
		
		public static function getGib(filter:String)
		{
			var result = db.nowShow(filter);
			
			return result;
		}
		
		public static function getAllNotes(filter:String)
		{
			var result = dbNotes.nowShow(filter);
			
			return result;
		}
		
		public static function addGib(obj:Object)
		{
			db.addGibInfo(obj.name,obj.phone,obj.mphone,obj.mail,obj.fav,obj.tweetName);
		}
		
		public static function addNote(obj:Object)
		{
			dbNotes.addGibInfo(obj.title,obj.text, obj.fav);
		}
		
		public static function editGib(obj:Object)
		{
			db.editGib(obj,obj);
		}
		
		public static function deleteGib(obj)
		{
			db.deleteNow(obj.uid,true);
		}
		
		public static function deleteNote(obj)
		{
			dbNotes.deleteNow(obj.uid,true);
		}
		
		public static function setFav(event,data,status)
		{
			db.changeFavStatus(data.uid,status,data);
		}
		
		public static function getOptions()
		{
			
		}
		
	}
}